﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.Mvc;

namespace SDT.Model
{
    public class CountryManager
    {
        public static IList<SelectListItem> SelectList(int current) { 
            SDTDataContext db = new SDTDataContext();
            var l = (from c in db.Countries select c).ToList();
            var ls = new List<SelectListItem>();
            foreach (var c in l) {
                SelectListItem s = new SelectListItem();
                s.Value = c.ID.ToString();
                s.Text = c.CountryName;
                s.Selected = c.ID == current ? true : false;
                ls.Add(s);
            }
            return ls;
        }
    }
}
